﻿@model ListCommentModel
@using Nop.Web.Models.WindAlert
@{
    Html.AddScriptParts("~/Scripts/jquery.magnific-popup.js");
    Html.AddCssFileParts("~/Content/magnific-popup/magnific-popup.css");

}
@if (Model.Comments.Count > 0)
{
    foreach (var comment in Model.Comments)
    {
        <div class="forum-post" style="min-height:120px">
            <div class="row">
                <div class="col-md-3 post-info">
                    <div class="user-info">
                        @if (comment.AllowViewingProfiles)
                        {
                        <h5><strong> @Html.RouteLink(comment.CustomerName, "CustomerProfile", new { id = comment.CustomerId }, new { @class = "username" })</strong></h5>
                        }
                        else
                        {
                        <h5><strong><span class="username">@comment.CustomerName</span></strong></h5>
                        }
                        @if (!String.IsNullOrEmpty(comment.CustomerAvatarUrl))
                        {
                        <div class="avatar">
                            <img src="@(comment.CustomerAvatarUrl)" class="avatar-img" alt="Avatar" />
                        </div>
                        }
                    </div>
                </div>
                <div class="col-md-9 post-content ">
                    <div class="posttime title mid-content-title row">
                        <div class="col-md-8">
                            <strong>@comment.SpotName</strong> - <span class="stat-value">@comment.CreatedOn.ToString("g")</span>
                        </div>
                        <div class="col-md-4 text-right">
                            @Html.RouteLink(T("Windalert.Spot.Comments.Delete").Text, "SpotCommentDelete", new { id = comment.Id, spotId = Model.SpotId }, new { onClick = String.Format("return confirm('{0}');", T("Common.AreYouSure").Text), @class = "btn  btn-xs btn-danger" })
                        </div>
                    </div>
                    <div class="post-body row">
                        <div class="col-md-9 posttext">
                            @Html.Raw(Nop.Core.Html.HtmlHelper.FormatText(comment.CommentText, false, true, false, false, false, false))
                        </div>
                        <div class="col-md-3">
                            @if (comment.PictureUrl != null)
                            {
                                <a href="@comment.PictureUrlFullSize" id="main-product-img-lightbox-anchor-@comment.Id">
                                    <img src="@(comment.PictureUrl)" />
                                </a>
                                <script type="text/javascript">
                                                $(document).ready(function () {
                                                    $('#main-product-img-lightbox-anchor-@comment.Id').magnificPopup(
                                                    {
                                                        type: 'image',
                                                        removalDelay: 300,
                                                        gallery: {
                                                            enabled: true
                                                        }
                                                    });
                                                });
                                </script>
                            }
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <hr />
    }
}
else
{ 
    <div class="row">
        <div class="col-md-12">
        <strong>@T("Windalert.Spot.Comments.None")</strong>    
        </div>
    </div>
}

